package com.dhms.vostok1.adapter

import android.view.View
import android.widget.ImageView
import coil.load
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.dhms.mine.R
import com.dhms.vostok1.data.select_mbr.MultiItemInfo

class SelectPopAdapter : BaseQuickAdapter<MultiItemInfo, BaseViewHolder>(R.layout.select_pop_item) {
    private var mListener: ((MultiItemInfo) -> Unit)? = null
    override fun convert(holder: BaseViewHolder, item: MultiItemInfo) {
        holder.getView<ImageView>(R.id.img_avatar).load("") {
            placeholder(R.drawable.ic_avatar_placeholder)
            error(R.drawable.ic_avatar_placeholder)
        }
        holder.setText(R.id.tv_name, item.mbr?.us_name)
        holder.getView<View>(R.id.tv_delete).setOnClickListener {
            mListener?.let {
                it(item)
            }
        }
    }

    fun setMemberSelectListener(listener: (MultiItemInfo) -> Unit) {
        mListener = listener
    }
}